<?php
class Wmp_Acl_Assertion implements Zend_Acl_Assert_Interface
{
    public function assert(Zend_Acl $acl,
                           Zend_Acl_Role_Interface $role = null,
                           Zend_Acl_Resource_Interface $resource = null,
                           $privilege = null)
    {
        
    	if($this->_isCleanIP($_SERVER['REMOTE_ADDR']))
    	{
    		//possibilité de mettre d'autres conditions ici
    		//For example, suppose that certain access should be allowed, 
    		//but only between the hours of 8:00am and 5:00pm
    		return true;
    	}
    	return false;
    }

    protected function _isCleanIP($ip)
    {
       	//je teste ici si l'ip est enrgistrée en tant que black liste ou pas
    	//et je renvoie true ou false...
    	$ips = new Wmp_Model_BlackListIpTable();
    	
    	if( isset($ips->find($ip)->current()->ip))
    		return false;
    	
    	return true;
    }
}